<%--
  Created by IntelliJ IDEA.
  User: root
  Date: 11/18/20
  Time: 10:38 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/firstdemo/CSS/w3.css">
<link rel="stylesheet" href="/firstdemo/CSS/google.css">
<link rel="stylesheet" href="/firstdemo/fontawesome/css/all.css">
<style>
    html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
    a{TEXT-DECORATION:none}
</style>

<script type="text/javascript" src="/firstdemo/JS/pageLogic.js"></script>
<head>
    <base href="<%=basePath%>">
    <title>Manager</title>
</head>
<body class="w3-light-grey">

<!-- Top container -->
<div class="w3-bar w3-top w3-teal w3-large" style="z-index:4">
    <button class="w3-bar-item w3-button w3-hide-large w3-hover-none w3-hover-text-light-grey" onclick="w3_open();"><i class="fa fa-bars"></i>  Menu</button>
    <span class="w3-bar-item w3-right">Logo</span>
</div>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-collapse w3-white w3-animate-left" style="z-index:3;width:300px;" id="mySidebar"><br>
    <div class="w3-container w3-row">
        <div class="w3-col s4">
            <img src="/firstdemo/images/avatar2.png" class="w3-circle w3-margin-right" style="width:46px">
        </div>
        <div class="w3-col s8 w3-bar">
            <span>Welcome, <strong>${username}</strong></span><br>
            <a  class="w3-bar-item w3-button"><i class="fa fa-envelope"></i></a>
            <a  class="w3-bar-item w3-button"><i class="fa fa-user"></i></a>
            <a  class="w3-bar-item w3-button"><i class="fa fa-cog"></i></a>
        </div>
    </div>
    <hr>
    <div class="w3-container">
        <h5>Dashboard</h5>
    </div>
    <div class="w3-bar-block">
        <a  class="w3-bar-item w3-button w3-padding-16 w3-hide-large w3-dark-grey w3-hover-black" onclick="w3_close()" title="close menu"><i class="fa fa-remove fa-fw"></i>  Close Menu</a>
        <a  class="w3-bar-item w3-button w3-padding" id="lookupbar" href="successM.jsp"><i class="fa fa-eye fa-fw"></i>
              <botton id = "lookup">查询</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="postbar"><i class="fa fa-eye fa-fw"></i>
              <botton id = "post">公告</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="userlistbar" href="FindUserList"><i class="fa fa-users fa-fw"></i>
              <botton id = "userlist">查看所有用户</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="friendbar"><i class="far fa-gem"></i>
              <botton id = "friend">Friend</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="commentbar"><i class="fa fa-bell fa-fw"></i>
              <botton id = "comment">Comment</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="quitbar" href="BacktoLogin"><i class="fa fa-history fa-fw"></i>
              <botton id = "quit">退出用户</botton></a>

        <a  class="w3-bar-item w3-button w3-padding" id="infobar"><i class="fa fa-cog fa-fw"></i>
              <botton id = "info">Info</botton></a><br><br>
    </div>
</nav>


<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large w3-animate-opacity" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>

<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:300px;margin-top:43px;">

    <!-- Header -->
    <header class="w3-container" style="padding-top:22px">
        <h5><b><i class="fa fa-dashboard"></i> My Dashboard</b></h5>
    </header>

    <div id = "alter1" class="w3-row-padding w3-margin-bottom" >

    </div>
    <!-- $# post list -->
    <div id = "alter2" class="w3-panel" display = "none">
        <div class="w3-row-padding" style="margin:0 -16px">

        </div>
    </div>
    <hr>
    <!-- $# user list -->
    <div id = "alter3" class="w3-container">
        <h1>列表</h1>
        <table class="w3-table w3-striped w3-bordered" cellpadding="0" >
            <tr>
                <th>ID</th>
                <th>姓名</th>
                <th>性别</th>
                <th>密码</th>
                <th>家乡</th>
                <th>备注</th>
                <th>删除</th>
                <th>更新</th>
            </tr>
            <c:forEach var="U" items="${userAll}"  >
                <form action="UpdateUser" method="post">
                    <tr>
                        <td><input class="w3-input" type="text" value="${U.id}" name="id" ></td>
                        <td><input class="w3-input" type="text" value="${U.name}" name="name"></td>
                        <td><input class="w3-input" type="text" value="${U.sex}" name="sex"></td>
                        <td><input class="w3-input" type="text" value="${U.pwd}" name="pwd"></td>
                        <td><input class="w3-input" type="text" value="${U.home}" name="home"></td>
                        <td><input class="w3-input" type="text" value="${U.info}" name="info"></td>
                        <td><botton  class="w3-button"><a href="DeleteUser?name=${U.name}">删除</a></botton></td>
                        <td><button class="w3-button w3-input " type="submit"value="更新">更新</button></td>
                    </tr>
                </form>
            </c:forEach>
        </table>
    </div>
    <hr>
    <!-- $# user lists friend -->
    <div id = "alter4" class="w3-container">
        <h5>Recent Users</h5>
        <ul class="w3-ul w3-card-4 w3-white">
            <li class="w3-padding-16">
                <img src="/firstdemo/images/avatar2.png" class="w3-left w3-circle w3-margin-right" style="width:35px">
                <span class="w3-xlarge">Mike</span><br>
            </li>
            <li class="w3-padding-16">
                <img src="/firstdemo/images/avatar5.png" class="w3-left w3-circle w3-margin-right" style="width:35px">
                <span class="w3-xlarge">Jill</span><br>
            </li>
            <li class="w3-padding-16">
                <img src="/firstdemo/images/avatar6.png" class="w3-left w3-circle w3-margin-right" style="width:35px">
                <span class="w3-xlarge">Jane</span><br>
            </li>
        </ul>
    </div>
    <hr>
    <!-- $# recent comments -->
    <div id = "alter5" class="w3-container">
        <h5>Recent Comments</h5>
        <div class="w3-row">
            <div class="w3-col m2 text-center">
                <img class="w3-circle" src="/firstdemo/images/avatar3.png" style="width:96px;height:96px">
            </div>
            <div class="w3-col m10 w3-container">
                <h4>John <span class="w3-opacity w3-medium">Sep 29, 2014, 9:12 PM</span></h4>
                <p>Keep up the GREAT work! I am cheering for you!! Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><br>
            </div>
        </div>

        <div class="w3-row">
            <div class="w3-col m2 text-center">
                <img class="w3-circle" src="/firstdemo/images/avatar1.png" style="width:96px;height:96px">
            </div>
            <div class="w3-col m10 w3-container">
                <h4>Bo <span class="w3-opacity w3-medium">Sep 28, 2014, 10:15 PM</span></h4>
                <p>Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><br>
            </div>
        </div>
    </div>
    <br>
    <!-- $# show page list -->
    <div id = "alter6" class="w3-container w3-dark-grey w3-padding-32">
        <div class="w3-row">
            <div class="w3-container w3-third">
                <h5 class="w3-bottombar w3-border-green">Demographic</h5>
                <p>Language</p>
                <p>Country</p>
                <p>City</p>
            </div>
            <div class="w3-container w3-third">
                <h5 class="w3-bottombar w3-border-red">System</h5>
                <p>Browser</p>
                <p>OS</p>
                <p>More</p>
            </div>
            <div class="w3-container w3-third">
                <h5 class="w3-bottombar w3-border-orange">Target</h5>
                <p>Users</p>
                <p>Active</p>
                <p>Geo</p>
                <p>Interests</p>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="w3-container w3-padding-16 w3-light-grey">
        <h4>FOOTER</h4>
        <p>Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank">w3.css + BUAA</a></p>
    </footer>

    <!-- End page content -->
</div>

<script>
    // Get the Sidebar
    var mySidebar = document.getElementById("mySidebar");

    // Get the DIV with overlay effect
    var overlayBg = document.getElementById("myOverlay");

    // Toggle between showing and hiding the sidebar, and add overlay effect
    function w3_open() {
        if (mySidebar.style.display === 'block') {
            mySidebar.style.display = 'none';
            overlayBg.style.display = "none";
        } else {
            mySidebar.style.display = 'block';
            overlayBg.style.display = "block";
        }
    }

    // Close the sidebar with the close button
    function w3_close() {
        mySidebar.style.display = "none";
        overlayBg.style.display = "none";
    }

    //
    var b1 = document.getElementById("lookup");
    var b2 = document.getElementById("post");
    var b3 = document.getElementById("userlist");
    var b4 = document.getElementById("friend");
    var b5 = document.getElementById("comment");
    var b6 = document.getElementById("quit");
    var b7 = document.getElementById("info");
    //
    function display(id){
        var traget=document.getElementById(id);
        if(traget.style.display==="none"){
            traget.style.display="block";
        }else{
            ;
        }
    }

    function hide(id){
        var traget=document.getElementById(id);
        if(traget.style.display==="none"){
            ;
        }else{
            traget.style.display="none";
        }
    }

    function activebar(id){
        var obj = document.getElementById(id);
        obj.className += ' w3-blue';
    }

    function negtivebar(id){
        var obj = document.getElementById(id);
        obj.className = "w3-bar-item w3-button w3-padding";
    }


    window.onload = function (){
        hide("alter1");
        hide("alter2");
        //hide("alter3");
        hide("alter4");
        hide("alter5");
        hide("alter6");
        activebar("userlistbar");
    }


    b1.onclick = function (){
        // display("alter1");
        // hide("alter2");
        // hide("alter3");
        // hide("alter4");
        // hide("alter5");
        // hide("alter6");
        // activebar("lookupbar");
        // negtivebar("postbar");
        // negtivebar("userlistbar");
        // negtivebar("friendbar");
        // negtivebar("commentbar");
        // negtivebar("infobar");
    }
    b2.onclick = function (){
        // display("alter2");
        // hide("alter1");
        // hide("alter3");
        // hide("alter4");
        // hide("alter5");
        // hide("alter6");
        // negtivebar("lookupbar");
        // activebar("postbar");
        // negtivebar("userlistbar");
        // negtivebar("friendbar");
        // negtivebar("commentbar");
        // negtivebar("infobar");
    }
    b3.onclick = function (){
        // display("alter3");
        // hide("alter1");
        // hide("alter2");
        // hide("alter4");
        // hide("alter5");
        // hide("alter6");
        // negtivebar("lookupbar");
        // negtivebar("postbar");
        // activebar("userlistbar");
        // negtivebar("friendbar");
        // negtivebar("commentbar");
        // negtivebar("infobar");
    }
    b4.onclick = function (){
        // display("alter4");
        // hide("alter1");
        // hide("alter2");
        // hide("alter3");
        // hide("alter5");
        // hide("alter6");
        // negtivebar("lookupbar");
        // negtivebar("postbar");
        // negtivebar("userlistbar");
        // activebar("friendbar");
        // negtivebar("commentbar");
        // negtivebar("infobar");
    }
    b5.onclick = function (){
        // display("alter5");
        // hide("alter1");
        // hide("alter2");
        // hide("alter3");
        // hide("alter4");
        // hide("alter6");
        // negtivebar("lookupbar");
        // negtivebar("postbar");
        // negtivebar("userlistbar");
        // negtivebar("friendbar");
        // activebar("commentbar");
        // negtivebar("infobar");
    }

    //b6 --> quit

    b7.onclick = function (){
        // display("alter6");
        // hide("alter1");
        // hide("alter2");
        // hide("alter3");
        // hide("alter4");
        // hide("alter5");
        // negtivebar("lookupbar");
        // negtivebar("postbar");
        // negtivebar("userlistbar");
        // negtivebar("friendbar");
        // negtivebar("commentbar");
        // activebar("infobar");
    }
</script>

<%

%>

</body>
</html>
